<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../img/asset-favico.ico">
    <title>编辑信息</title>
<!--    <link rel="stylesheet" href="../css/page-health-orderInfo.css"/>-->
    <link rel="stylesheet" href="../plugins/elementui/index.css"/>
    <link rel="stylesheet" href="../css/style.css">
<!--    <script src="../plugins/jquery/dist/jquery.min.js"></script>-->
    <script src="../plugins/datapicker/datePicker.js"></script>
    <script src="../plugins/vue/vue.js"></script>
    <script src="../plugins/vue/axios-0.18.0.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script src="../plugins/healthmobile.js"></script>
    <script src="../plugins/echarts/echarts.js"></script>

</head>
<body class="hold-transition">
<div id="app">
    <!-- 页面头部 -->
    <div class="content-header">
        <h1>统计分析
            <small>会员数量</small>
        </h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>会员数量</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <!-- 页面内容 -->
    <div style="width: 80%;margin-left: 150px">
        <div class="date" style="display: inline">
            <label>起始日期</label>
            <input v-model="orderInfo.orderDate1" type="text" class="picktime1" readonly>
        </div>
        <div class="date" style="display: inline;margin-left: 200px">
            <label>结束日期</label>
            <input v-model="orderInfo.orderDate2" type="text" class="picktime2" readonly>
        </div>
        <div class="box-button" style="display: inline">
            <button @click="submitOrder()" type="button" class="btn order-btn">查询</button>
        </div>
    </div>
    <div class="app-container">
        <div class="box">
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="chart1" style="height:600px;"></div>
            <div id="chart2" style="height:600px;"></div>
        </div>
    </div>

</div>
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            orderInfo: {},//绑定日历时间
        },
        methods: {
            //查询方法
            submitOrder() {
                if (this.orderInfo.orderDate1 != null && this.orderInfo.orderDate2 != null) {
                    var parmes = {
                        orderDate1: this.orderInfo.orderDate1,
                        orderDate2: this.orderInfo.orderDate2
                    }
                    axios.post("http://localhost:82/member/findByDateZdy.do", parmes).then((res) => {
                        if (res.data.data == null) {
                            alert("请进行合理操作");
                        }
                        myChart1.setOption(
                            {
                                title: {
                                    text: '会员数量'
                                },
                                tooltip: {},
                                legend: {
                                    data: ['会员数量']
                                },
                                xAxis: {
                                    data: res.data.data.months
                                },
                                yAxis: {
                                    type: 'value'
                                },
                                series: [{
                                    name: '会员数量',
                                    type: 'line',
                                    data: res.data.data.memberCount
                                }]
                            });
                    });
                } else {
                    alert("日期选项不能为空！！！");
                }
            }
        },
    });
</script>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart1 = echarts.init(document.getElementById('chart1'));
    //初始化加载折线图
    axios.get("http://localhost:82/member/findByDate.do").then((res) => {
        myChart1.setOption(
            {
                title: {
                    text: '会员数量'
                },
                tooltip: {},
                legend: {
                    data: ['会员数量']
                },
                xAxis: {
                    data: res.data.data.months
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    name: '会员数量',
                    type: 'line',
                    data: res.data.data.memberCount
                }]
            });
    });
</script>
<script>
    //日期控件1
    var calendar = new datePicker();
    calendar.init({
        'trigger': '.picktime1', /*按钮选择器，用于触发弹出插件*/
        'type': 'ym', /*模式：date日期；datetime日期时间；time时间；ym年月；*/
        'minDate': '2016-10', /*最小日期*/
        'maxDate': '2019-8', /*最大日期*/
        'onSubmit': function () { /*确认时触发事件*/
        },
        'onClose': function () { /*取消时触发事件*/
        }
    });
    //日期控件2
    var calendar2 = new datePicker();
    calendar2.init({
        'trigger': '.picktime2', /*按钮选择器，用于触发弹出插件*/
        'type': 'ym', /*模式：date日期；datetime日期时间；time时间；ym年月；*/
        'minDate': '2013-1', /*最小日期*/
        'maxDate': '2019-9', /*最大日期*/
        'onSubmit': function () { /*确认时触发事件*/
        },
        'onClose': function () { /*取消时触发事件*/
        }
    });
</script>
</body>
</html>